from PyQt4.QtCore import Qt
from PyQt4.QtGui import QWidget, QLabel, QPixmap, QFont
from .image_button import ImageButton

class TitlePanel(QLabel):
	def __init__(self, *args, **kw):
#
#		parent constructor and geometry
#
		QLabel.__init__(self, *args, **kw)
		self.setGeometry(0, 0, 336, 50)
#
#		set up a font. I'm not sure Gabrielle works
#		so well for this panel, but I've not found anything
#		better yet. So for the time being...
#
		font = QFont("Gabrielle", 28)
		self.setFont(font)
#
#		a stylesheet to set the background image
#
		ss = """
			QLabel {
				background-color : transparent;
				background-image : url(work/title_panel.png);
			}
		"""
		self.setStyleSheet(ss)
#
#		make the text centered in the label
#
		self.setAlignment(Qt.AlignCenter)


#
# this widget displays the brothel statistics
#
class TitleAndButtons(QWidget):
	def __init__(self, *args, **kw):
		QWidget.__init__(self, *args, **kw)

		self.prev_butt = ImageButton("prev_butt", self,
			"work/prev_butt.png",
			"work/prev_butt_over.png",
			"work/prev_butt_down.png",
			"work/prev_butt.png"
		)
		self.prev_butt.setGeometry(0, 0, 52, 52)

		self.title = TitlePanel(self)
		self.title.setText("Nameless")
		self.title.setGeometry(60, 0, 336, 50)

		self.next_butt = ImageButton("next_butt", self,
			"work/next_butt.png",
			"work/next_butt_over.png",
			"work/next_butt_down.png",
			"work/next_butt.png"
		)
		self.next_butt.setGeometry(396, 0, 52, 52)

	def set_prev_func(self, func):
		self.prev_butt.clicked.connect(func)
	def set_next_func(self, func):
		self.next_butt.clicked.connect(func)
	def set_title_text(self, text):
		self.title.setText(text)


